package com.ld.hpfs.service.impl;

import java.util.ArrayList;
import java.util.HashMap;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.ld.hpfs.dao.ReportMapper;
import com.ld.hpfs.pojo.customerBill;
import com.ld.hpfs.service.ReportService;
@Service
public class ReportServiceImpl implements ReportService {
	private static final Logger logger = LoggerFactory.getLogger(ReportServiceImpl.class);
	@Autowired
	private ReportMapper reportMapper;
	@Override
	public ArrayList<HashMap<String, Object>> getReportTaskGridList(
			HashMap<String, Object> param) {
		int count = reportMapper.getReportTaskGridListCount(param);
		if(count == 0){
			return null;
		}else{
			param.put("pageCount", count);
			return reportMapper.getReportTaskGridList(param);
		}
	}
	@Override
	public int insertReportTaskGridList(HashMap<String, Object> param) {
		try{
			reportMapper.insertReportTaskGridList(param);
			  return 0;
			}catch(Exception ex){
				logger.error(ex.getMessage());	
				return -1;			
			}	
	}
	@Override
	public int getReportTaskId() {
		try{
			return reportMapper.getReportTaskId();	
		}catch(Exception ex){
			logger.error(ex.getMessage());	
			return -1;			
		}
	}
	//获取客户代码及名称
	@Override
	public ArrayList<HashMap<String, Object>> getCustId(HashMap<String, Object> param) {
		// TODO Auto-generated method stub
		return reportMapper.getCustId(param);
	}
	//获取单据号
	@Override
	public ArrayList<HashMap<String, Object>> getDocumnetNo(HashMap<String, Object> param) {
		// TODO Auto-generated method stub
		return reportMapper.getDocumnetNo(param);
	}
	//取得发票号码
	@Override
	public ArrayList<HashMap<String, Object>> getInvoiceNo(HashMap<String, Object> param) {
		// TODO Auto-generated method stub
		return reportMapper.getInvoiceNo(param);
	}
	@Override
	public ArrayList<customerBill> getnums(
			HashMap<String, Object> param) {
		// TODO Auto-generated method stub
		return reportMapper.getnums(param);
	}
	@Override
	public ArrayList<HashMap<String, Object>> getCalculater(
			HashMap<String, Object> pamget) {
		// TODO Auto-generated method stub
		return reportMapper.getCalculater(pamget);
	}
	@Override
	public void saveBillData(customerBill customerBill) {
		// TODO Auto-generated method stub
		reportMapper.saveBillData(customerBill);
	}
	@Override
	public void insertOrigiDoc(HashMap<String, Object> paramforbill) {
		// TODO Auto-generated method stub
		reportMapper.insertOrigiDoc(paramforbill);
	}
	@Override
	public void updateTotal(HashMap<String, Object> paramForTotal) {
		// TODO Auto-generated method stub
		reportMapper.updateTotal(paramForTotal);
	}
}
